﻿using System;
using System.Web.Mvc;
using AcademicPlanner.Framework.Helpers;
using AcademicPlanner.Domain.Models;
using AcademicPlanner.Presentation.Views.Shared;

namespace AcademicPlanner.Presentation.Views.People
{
	/// <summary>
	/// Represents the view model of the page to complete the registration process.
	/// </summary>
	/// <version>1.0</version>
	/// <since>1.0</since>
	public class SetupPersonViewModel
	{
		/// <summary>
		/// Gets or sets the person whose registration is to be completed.
		/// </summary>
		/// <version>1.0</version>
		/// <since>1.0</since>
		public Person Person { get; set; }
	}


	/// <summary>
	/// Represents the page to complete the registration process.
	/// </summary>
	/// <version>1.0</version>
	/// <since>1.0</since>
	public partial class Setup : View<SetupPersonViewModel>
	{
		/// <summary>
		/// Gets or sets the model of the form to complete the registration contained in this page.
		/// </summary>
		/// <version>1.0</version>
		/// <since>1.0</since>
		public PersonFormModel SavePersonModel { get; set; }

		/// <summary>
		/// Handles the load page event. This method sets the page heading and title and
		/// initializes the model of the to complete the registration process contained in this page.
		/// </summary>
		/// <param name="sender">The sender of the event.</param>
		/// <param name="e">The details of the event.</param>
		/// <seealso cref="P:AcademicPlanner.Presentation.Views.Shared.SavePersonFormScenario.COMPLETE_REGISTRATION"/>
		/// <version>1.0</version>
		/// <since>1.0</since>
		protected void Page_Load(object sender, EventArgs e)
		{
			pageHeading = Tr("Complete Registration");
			Title = string.Format(Tr(titleFormat), pageHeading);

			SavePersonModel = new PersonFormModel();
			SavePersonModel.Scenario = PersonFormScenario.COMPLETE_REGISTRATION;
			SavePersonModel.Person = Model.Person;
		}
	}
}
